/**
 * 计算函数的执行时间
 * @returns {Number} 执行的时间毫秒
 * @example
 * function example () {
 *   new Array(10000).fill(0).forEach(v => v)
 * }
 * let time = computeNextTime(example) // time就是example函数的执行时间
 */
export const computeNextTime = (callback) => {
	if (typeof callback !== 'function') return new Date();
	let start = Date.now();
	callback();
	let stop = Date.now();
	// ms
	return stop - start;
};

const express = function () {
	let arr = new Array(100);
	arr.forEach((item) => {});
	console.log(arr);
};

console.log(computeNextTime(express));
